import Vue from 'vue'
import "babel-polyfill"
import Vuex from 'vuex'
import state from './state'
import * as actions from './action'
import * as getters from './getters'
import mutations from './mutations'
//引入日志，输出所有状态改变
import createLogger from 'vuex/dist/logger'
//vuex 状态管理本地化
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
  state,
  getters,
  actions,
  mutations,
  plugins: debug ? [createLogger(),createPersistedState()] : [createPersistedState()]
})
